home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / pp / nocommen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-01  |  960 b   |  33 lines

  1. /*
  2.                                 N O C O M M E N . C
  3.  
  4.     The function no_comment() removes comment found on a #define-line
  5.     before entering the define-definition.
  6.  
  7.     The define-line is stored in lexbuf[]
  8. */
  9.  
  10. #include "icm-pp.h"
  11.  
  12. void no_comment()
  13. {
  14.     char
  15.         *cp;                                /* look for / */
  16.  
  17.     cp = lexbuf;                            /* get first char-address */
  18.  
  19.     while (cp = strchr(cp, '/'))            /* any slash ? */
  20.     {
  21.         if (*(cp + 1) == '/')               /* next one is a slash too: */
  22.         {
  23.             *cp = 0;                        /* so we have eoln-comment   */
  24.             return;                         /* and the define stops here */
  25.         }
  26.  
  27.         if (*(cp + 1) == '*')               /* we have std comment    */
  28.             delete_std_comment(cp);         /* delete the std comment */
  29.         else
  30.             cp++;                           /* else skip the /  */        
  31.     }
  32. }
  33.